package com.example.app;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class IdiomaArrayAdapter extends ArrayAdapter<Idioma> {

	
	Context contexto;
	ArrayList<Idioma> idiomas;
	public IdiomaArrayAdapter(Context context, int textViewResourceId,
			List<Idioma> objects) {
		super(context, textViewResourceId, objects);
		// TODO Auto-generated constructor stub
		contexto = context;
		idiomas = (ArrayList<Idioma>)objects;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		LayoutInflater constructor = ((Activity) contexto).getLayoutInflater();
		View item = constructor.inflate(R.layout.adpater_pregunta1, null);

		TextView tv_idioma = (TextView) item.findViewById(R.id.tv_pregunta2);
		tv_idioma.setText(idiomas.get(position).getIdioma());

		ImageView iv_imagen = (ImageView) item.findViewById(R.id.imageView1);
		iv_imagen.setImageResource(idiomas.get(position).getFoto());

		return item;
		
	
	}
	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		return getView(position, convertView, parent);
	}
	
	
	
	

}
